package top.italks.demo.mapper;

import org.apache.ibatis.annotations.Mapper;
import top.italks.demo.entity.AliOrderEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Update;

/**
 * 支付宝支付交易单Mapper
 *
 * @Author: 陈忠波
 * @Date: 2019/09/10 04:11
 */
@Mapper
public interface AliOrderMapper {

    /**
     * 新增 支付宝支付交易单
     *
     * @param aliOrderEntity 支付宝支付交易单
     * @return 影响条数
     */
    @Insert({"INSERT INTO `pay_aliorder`(`out_trade_no`,`total_amount`,`subject`,`body`)VALUES(#{out_trade_no},#{total_amount},#{subject},#{body})"})
    int add(AliOrderEntity aliOrderEntity);

    /**
     * 根据 商户订单号 修改 支付宝支付交易单
     *
     * @param aliOrderEntity 支付宝支付交易单
     * @return 影响条数
     */
    @Update({"UPDATE `pay_aliorder` SET `seller_id`=#{seller_id},`app_id`=#{app_id},`buyer_id`=#{buyer_id},`buyer_logon_id`=#{buyer_logon_id},`notify_id`=#{notify_id},`notify_time`=#{notify_time},`notify_type`=#{notify_type},`trade_no`=#{trade_no},`trade_status`=#{trade_status} WHERE `out_trade_no`=#{out_trade_no}"})
    int modifyByOutTradeNo(AliOrderEntity aliOrderEntity);

}
